home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et-2_2.lha / et2.2 / src / ShellTView.h < prev    next >
C/C++ Source or Header  |  1990-11-28  |  3KB  |  86 lines

  1. #ifndef ShellTView_First
  2. #ifdef __GNUG__
  3. #pragma once
  4. #endif
  5. #define ShellTView_First
  6.  
  7. #include "FixLineTView.h"
  8. #include "PttyConnection.h"
  9. #include "CmdNo.h"
  10.  
  11. extern Rectangle gShellTextViewRect;
  12. extern char *gDefaultArgv[];
  13.  
  14. //---- ShellTextView --------------------------------------------------------
  15. // a TextView connected to a ptty running a shell
  16.  
  17. class ShellTextView: public FixedLineTextView {
  18.     class PttyInputHandler *pttyinp;
  19.     class ShellZombieHandler *zombieHandler;
  20.     class PttyConnection *pttycon;
  21.     class Mark *outputCursor, *inputCursor;
  22.     bool doReveal;
  23.     class CheapText *noEchoBuffer;  // used when echo is turned off
  24.     int lastSubmit;
  25.     int state;          // for interpreting ESC-Sequences
  26.     bool pendingCR;     
  27.     PttyChars pttyc;    // tty-chararacters that submit a command
  28.     char *pttycstr;
  29.     char **argv;
  30.  
  31.     void Init(bool doReveal, char *name, char **argv, bool cons);
  32.     void Term();
  33.     bool ModifiesReadOnly();
  34.     void Wrap();
  35.     void BackSpace(Text *t);
  36.     void CarriageReturn(Text *t);
  37.     void ProcessOutput(Text *t, char *buf, int size);
  38.     void MarksToEOT();
  39.     void DrawOutputCursor(Point p);
  40. protected:
  41.     virtual void InsertReceivedText(Text *t, int from, int to);
  42. public:
  43.     MetaDef(ShellTextView);
  44.  
  45.     ShellTextView(EvtHandler *eh, Rectangle r, Text *t, char *name= 0,
  46.         char **args= 0, bool becomeconsole= FALSE, eTextJust m= eLeft, 
  47.         eSpacing= eOne, TextViewFlags= (TextViewFlags)eVObjDefault, 
  48.             Point border = gBorder, int id = -1);    
  49.         // for efficency reasons do not set contentRect.extent.x to cFit
  50.     ~ShellTextView();
  51.     /* virtual */ char *GetTermCap();
  52.     /* virtual */ char *GetTerm();
  53.     void BecomeConsole();
  54.     void Received();
  55.     void Submit(char *buf, int size); 
  56.     void SubmitInterrupt(char c); 
  57.     void SlaveDied();
  58.     void CleanupDeath();
  59.     Command *CntrlChar(byte b);   
  60.     void DoReveal(bool);    
  61.     void Draw(Rectangle);   // draw output cursor
  62.     Text *SetText(Text *);     // returns old text       
  63.     void SetTtySize(int rows, int cols);
  64.     void SetTtySize(Rectangle r, Font *fd);
  65.     char **GetArgv()
  66.     { return argv; }
  67.     void Clear();
  68.     void Reconnect();
  69.     void Doit();
  70.     Command *TtyInput(char *buf, int len= -1); // appends buf to ttys input queue
  71.  
  72.     //---- overridden to maintain a fence of read only text
  73.     bool DeleteRequest(int from, int to);
  74.     void Paste(Text *insert);
  75.     //---- controller methods 
  76.     Command *DoKeyCommand(int, Point, Token); 
  77.     void DoSetupMenu(class Menu *);
  78.     Command *DoMenuCommand(int);
  79.     void SelectAll();
  80.     //---- input/output
  81.     ostream& PrintOn (ostream&);
  82.     istream& ReadFrom(istream&);
  83. };
  84.  
  85. #endif ShellTView_First  
  86.